package com.itboye.mengwu.data.presenter;

import java.util.List;
import java.util.Observer;

import com.itboye.core.interfaces.ICompleteListener;
import com.itboye.core.object.BasePresenter;
import com.itboye.core.object.ResultEntity;
import com.itboye.mengwu.app.ui.main.MainPresenter;
import com.itboye.mengwu.data.interfaces.IAddGoods;
import com.itboye.mengwu.data.interfaces.IAddressQuery;
import com.itboye.mengwu.data.interfaces.IKeyWordsQuery;
import com.itboye.mengwu.data.model.GoodsListModel;
import com.itboye.mengwu.data.model.KeyWordQueryModel;
import com.itboye.mengwu.data.repository.KeyWordQueryRepository;

public class KeyWordQueryPresenter extends BasePresenter implements
		IKeyWordsQuery<KeyWordQueryModel> {
	public static final String Query_success = MainPresenter.class.getName()
			+ "_Query_success";
	public static final String Query_fail = MainPresenter.class.getName()
			+ "_Query_fail";

	public KeyWordQueryPresenter(Observer observer) {
		super(observer);
		// TODO Auto-generated constructor stub
	}

	@Override
	public void add(KeyWordQueryModel model) {
		// TODO Auto-generated method stub

	}

	@Override
	public void delete(KeyWordQueryModel model) {
		// TODO Auto-generated method stub

	}

	@Override
	public void update(KeyWordQueryModel model) {
		// TODO Auto-generated method stub

	}

	@Override
	public void getInfo(KeyWordQueryModel model) {
		// TODO Auto-generated method stub

	}

	@Override
	public List<KeyWordQueryModel> queryYouHuiQuan(KeyWordQueryModel model) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void WordQuery(String sort) {
		// TODO Auto-generated method stub
		IKeyWordsQuery<KeyWordQueryModel> iKeyWordsQuery = new KeyWordQueryRepository(
				new ICompleteListener() {

					@Override
					public void success(ResultEntity result) {
						// TODO Auto-generated method stub
						result.setEventTag(Tag_Success);
						result.setEventType(Query_success);
						KeyWordQueryPresenter.this.setChanged();
						KeyWordQueryPresenter.this.notifyObservers(result);
					}

					@Override
					public void failure(ResultEntity result) {
						// TODO Auto-generated method stub
						result.setEventTag(Tag_Success);
						result.setEventType(Query_fail);
						KeyWordQueryPresenter.this.setChanged();
						KeyWordQueryPresenter.this.notifyObservers(result);
					}
				});
		iKeyWordsQuery.WordQuery(sort);
	}
}
